package com.ziven.common.widget.test;

import android.view.Gravity;
import android.view.ViewGroup;
import android.widget.RelativeLayout;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.ziven.common.widget.layout.Make;
import com.ziven.common.widget.layout.Make2;
import com.ziven.common.widget.layout.Make3;

/**
 * @author Ziven
 */
final class MakeViewCases {

    @NonNull
    public static String using() {
        //return usingMake2();
        //return usingMake();
        return usingString();
        //return usingMake22();
        //return usingMake23();
    }

    @NonNull
    public static String usingString() {
        return Make3.replaceIds(
                "<rl=tag:parent,root;w:-1.0;h:60.0dp;bgColor:0xFF6200EE;>" +
                "<tv=p:root;id:%id_0;size:24.0sp;color:#FF000000;margin:16.0dp,16.0dp,16.0dp,16.0dp;>" +
                "<v0=p:root;id:%id_1;wh:-2.0,-2.0;size:24.0sp;color:0xFF000000;c0:android.widget.TextView;rule:1,%id_0;margin:16.0dp,16.0dp,16.0dp,16.0dp;font:bold;>" +
                "<ll=p:root;tag:parent,root1;w:-2.0;h:50.0dp;o:h;bgColor:#FF00FF00;rule:1,%id_1;>" +
                "<tv=p:root1;wh:-2.0,-2.0;size:24.0sp;t:TEXT1;color:0xFFFFFFFF;gravity:parent,16;>" +
                "<tv=p:root1;wh:-2.0,-2.0;size:24.0sp;t:TEXT2;color:0xFFFFFFFF;margin:0,0,16.0dp,0;>"
        );
    }

    @NonNull
    public static String usingMake() {
        return Make.create(
                Make.relative(
                        Make.group("root"),
                        Make.width(ViewGroup.LayoutParams.MATCH_PARENT),
                        Make.heightDp(60),
                        Make.bgColor(0xFF6200EE)),
                Make.text(
                        Make.parent("root"),
                        Make.id(com.ziven.common.widget.R.id.easy_common_widget_id_0),
                        Make.textSizeSp(24),
                        Make.textColor("#FF000000"),
                        Make.margin(Make.gapDp(16))
                ),
                Make.view0(
                        Make.parent("root"),
                        Make.view(com.ziven.common.widget.R.id.easy_common_widget_id_1,
                                ViewGroup.LayoutParams.WRAP_CONTENT,
                                ViewGroup.LayoutParams.WRAP_CONTENT),
                        Make.text(24, 0xFF000000),
                        Make.cls0("android.widget.TextView"),
                        Make.rule(RelativeLayout.RIGHT_OF,
                                com.ziven.common.widget.R.id.easy_common_widget_id_0),
                        Make.margin(Make.gapDp(16)),
                        Make.fontBold()
                ),
                Make.linear(
                        Make.parent("root"),
                        Make.group("root1"),
                        Make.width(ViewGroup.LayoutParams.WRAP_CONTENT),
                        Make.heightDp(50),
                        Make.orientationH(),
                        Make.bgColor("#FF00FF00"),
                        Make.rule(RelativeLayout.RIGHT_OF,
                                com.ziven.common.widget.R.id.easy_common_widget_id_1)
                ),
                Make.text(
                        Make.parent("root1"),
                        Make.widthHeight(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT),
                        Make.textSizeSp(24),
                        Make.textText("TEXT1"),
                        Make.textColor("0xFFFFFFFF"),
                        Make.parentGravity(Gravity.CENTER_VERTICAL)
                ),
                Make.text(
                        Make.parent("root1"),
                        Make.widthHeight(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT),
                        Make.textSizeSp(24),
                        Make.textText("TEXT2"),
                        Make.textColor("0xFFFFFFFF"),
                        Make.margin(Make.startDp(16))
                )
        );
    }

    @NonNull
    public static String usingMake2() {
        return Make2.tree(
                Make2.relative()
                        .matchWidth().height(60)
                        .bgColor(0xFF6200EE).make(),
                Make2.text()
                        .wrap().id(com.ziven.common.widget.R.id.easy_common_widget_id_0)
                        .textSizeSp(24).textColor("#FF000000")
                        .margin(Make.gapDp(16)).make(),
                Make.view0(
                        Make.view(com.ziven.common.widget.R.id.easy_common_widget_id_1,
                                ViewGroup.LayoutParams.WRAP_CONTENT,
                                ViewGroup.LayoutParams.WRAP_CONTENT),
                        Make.text(24, 0xFF000000),
                        Make.cls0("android.widget.TextView"),
                        Make.rule(RelativeLayout.RIGHT_OF,
                                com.ziven.common.widget.R.id.easy_common_widget_id_0),
                        Make.margin(Make.gapDp(16)),
                        Make.fontBold()
                ),
                Make2.tree(
                        Make2.linear()
                                .wrapWidth()
                                .height(50)
                                .orientationH()
                                .bgColor("#FF00FF00")
                                .rule(RelativeLayout.RIGHT_OF,
                                        com.ziven.common.widget.R.id.easy_common_widget_id_1)
                                .make(),
                        Make2.text()
                                .wrap()
                                .textColor("0xFFFFFFFF")
                                .parentGravity(Gravity.CENTER_VERTICAL)
                                .textSizeSp(24)
                                .textText("TEXT1")
                                .make(),
                        Make2.text()
                                .wrap()
                                .textColor("0xFFFFFFFF")
                                .textSizeSp(24)
                                .textText("TEXT2")
                                .margin(Make.startDp(16))
                                .make()
                )
        );
    }

    @NonNull
    public static String usingMake22() {
        return Make2.relative().matchWidth().height(60).bgColor(0xFF6200EE).make(

                Make2.text().wrap().id(com.ziven.common.widget.R.id.easy_common_widget_id_0)
                        .textSizeSp(24).textColor("#FF000000").margin(Make.gapDp(16)).make(),

                Make2.view(TextView.class)
                        .wrap().id(com.ziven.common.widget.R.id.easy_common_widget_id_1)
                        .textSizeSp(24).textColor(0xFF000000).margin(Make.gapDp(16)).fontBold()
                        .rule(RelativeLayout.RIGHT_OF, com.ziven.common.widget.R.id.easy_common_widget_id_0).make(),

                Make2.linear().wrapWidth().height(50).orientationH().bgColor("#FF00FF00")
                        .rule(RelativeLayout.RIGHT_OF, com.ziven.common.widget.R.id.easy_common_widget_id_1)
                        .make(
                                Make2.text().wrap().textColor("0xFFFFFFFF")
                                        .parentGravity(Gravity.CENTER_VERTICAL)
                                        .textSizeSp(24).textText("TEXT1").make(),
                                Make2.text().wrap().textColor("0xFFFFFFFF")
                                        .textSizeSp(24).textText("TEXT2")
                                        .margin(Make.startDp(16)).make()
                        )
        );
    }

    @NonNull
    public static String usingMake23() {
        return Make2.relative2(
                    Make2.linear().wrapWidth().height(50).orientationH().bgColor("#FF00FF00")
                        .rule(RelativeLayout.RIGHT_OF, com.ziven.common.widget.R.id.easy_common_widget_id_1)
                        .make(
                                Make2.text().wrap().textColor("0xFFFFFFFF")
                                        .parentGravity(Gravity.CENTER_VERTICAL)
                                        .textSizeSp(24).textText("TEXT1"),
                                Make2.text().wrap().textColor("0xFFFFFFFF")
                                        .textSizeSp(24).textText("TEXT2")
                                        .margin(Make.startDp(16))
                        )
                ).matchWidth().height(60).bgColor(0xFF6200EE).make(

                    Make2.text().wrap().id(com.ziven.common.widget.R.id.easy_common_widget_id_0)
                        .textSizeSp(24).textColor("#FF000000").margin(Make.gapDp(16)),

                    Make2.view(TextView.class)
                        .wrap().id(com.ziven.common.widget.R.id.easy_common_widget_id_1)
                        .textSizeSp(24).textColor(0xFF000000).margin(Make.gapDp(16)).fontBold()
                        .rule(RelativeLayout.RIGHT_OF, com.ziven.common.widget.R.id.easy_common_widget_id_0)
        );
    }
}
